#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["windows_mssql_exporter/windows_mssql_exporter.csproj", "windows_mssql_exporter/"]
RUN dotnet restore "windows_mssql_exporter/windows_mssql_exporter.csproj"
COPY . .
WORKDIR "/src/windows_mssql_exporter"
RUN dotnet build "windows_mssql_exporter.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "windows_mssql_exporter.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "windows_mssql_exporter.dll"]